package com.easygoods.enums;

import com.bestvike.stone.core.collection.ArrayUtils;

/**
 * Created by 许崇雷 on 2019-01-18.
 */
public enum AttachFileType {
    Image,//图片
    Binary;//二进制文件

    private static final String[] IMAGE_EXT = {".bmp", ".jpg", ".jpeg", ".gif", ".png"};


    //根据扩展名判断文件类型,注意:扩展名带点
    public static AttachFileType fromExt(String ext) {
        return ArrayUtils.contains(IMAGE_EXT, ext) ? Image : Binary;
    }
}
